#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ball;  // number, count
queue<ball> q;
int main() {
  int m;
  cin >> m;
  while (m--) {
    int op;
    cin >> op;
    if (op == 1) {
      int x, c;
      cin >> x >> c;
      q.emplace(x, c);
    } else {
      int c;
      cin >> c;
      ll sum = 0;
      while (c) {
        auto& [x, has] = q.front();
        if (has > c) {
          sum += 1LL * c * x;
          has -= c;
          c = 0;
        } else {
          sum += 1LL * has * x;
          c -= has;
          q.pop();
        }
      }
      cout << sum << endl;
    }
  }
}
